import type {Executor} from '../';
import type {FormDTO} from '../model/static/';

export class DbDesignController {

    constructor(private executor: Executor) {
    }

    dbdesign: (options: DbDesignControllerOptions['dbdesign']) => Promise<
        FormDTO
    > = async (options) => {
        let _uri = '/dbdesign';
        let _separator = _uri.indexOf('?') === -1 ? '?' : '&';
        let _value: any = undefined;
        _value = options.modelName;
        _uri += _separator
        _uri += 'modelName='
        _uri += encodeURIComponent(_value);
        _separator = '&';
        _value = options.ques;
        _uri += _separator
        _uri += 'ques='
        _uri += encodeURIComponent(_value);
        _separator = '&';
        return (await this.executor({uri: _uri, method: 'GET'})) as Promise<FormDTO>;
    }
}

export type DbDesignControllerOptions = {
    'dbdesign': {
        modelName: string,
        ques: string
    }
}